package com.anyview.service.impl;

import com.alibaba.excel.EasyExcel;
import com.anyview.po.CompanyGoods;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;


import java.io.IOException;
import java.util.List;
import java.util.function.Consumer;

@Component
public class ExcelReader {

    public void readExcel(MultipartFile file , Consumer<List<CompanyGoods>> consumer) throws IOException {
        EasyExcel.read(file.getInputStream(), CompanyGoods.class, new ExcelDataListener(consumer)).sheet().doRead();
    }
}
